/**
 * Copyright (C), 2019-2020, 宇信融汇
 * FileName: IteratorDemo
 * Author:   666
 * Date:     2020/7/4 8:02
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 666           修改时间           版本号              描述
 */
package c_008.iterator;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @Classname IteratorDemo
 * @Description TODO
 * @Date 2020/7/4 8:02
 * @Created by 666
 */
public class IteratorDemo {
    public static void main(String[] args) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(1);
        arrayList.add(2);
        arrayList.add(3);
        arrayList.add(4);
        System.out.println(arrayList);
        System.out.println("-----------------------------------------");
        // ListIterator iterator = arrayList.listIterator();
        Iterator iterator = arrayList.iterator();
        while (iterator.hasNext()) {
            Object o = iterator.next();
            if (o.equals(1)) {
                arrayList.remove(o);
            }
            System.out.println(o);
        }

        System.out.println(arrayList);
       // arrayList.contains()
    }
}
